#ifndef ATTO_H
#define ATTO_H

#include "atto_internals.h"
#include "Common.h"

// -----------------------------------------------------------------------------------
// ---------------- Handler Types and Setup Function ---------------------------------
// -----------------------------------------------------------------------------------

typedef void (*AttoKeyFunction)(int code);
typedef void (*AttoMouseDownFunction)(int x, int y, int button);
typedef void (*AttoMouseDragFunction)(int x, int y, int button);
typedef void (*AttoMouseUpFunction)(int x, int y, int button);
typedef void (*AttoDrawFunction)();
typedef void (*AttoGenericFunction)(void *custom);

// set the size of your area and the event handlers before atto_main
void atto_setup(int w, int h, 
		AttoKeyFunction key, 
		AttoMouseDownFunction down, 
		AttoMouseDragFunction drag, 
		AttoMouseUpFunction up, 
		AttoDrawFunction draw);
		
// hand control over to atto and start the GUI running
int atto_main(int argc, char **argv);

// -----------------------------------------------------------------------------------
// ---------------- Drawing Functions ------------------------------------------------
// -----------------------------------------------------------------------------------

void atto_color(float r, float g, float b);
void atto_frame(int left, int top, int w, int h);
void atto_fill(int left, int top, int w, int h); 
void atto_line(int x1, int y1, int x2, int y2);
void atto_string(int left, int baseline, const char *string); 
void atto_gif(int left, int top, const char *path_to_image); 
void atto_arc(int left, int top, int w, int h, double degree1, double degree2);

// get the size a string will draw
void atto_measure_string(const char *string, int *w, int *h);

// cause a redraw of the area (will call your draw() handler)
void atto_redraw();

// -----------------------------------------------------------------------------------
// ---------------- Extra / Rarely Used Functions ------------------------------------
// -----------------------------------------------------------------------------------

// atto will call f(custom) after a delay of secs_from_now
void atto_timeout(float secs_from_now, AttoGenericFunction f, void *custom);

// atto will call f(custom) whenever there is nothing else going on
void atto_idle_start(AttoGenericFunction f, void *custom);
// removes a previously installed idle function (do not use with atto_timeout)
void atto_idle_end(AttoGenericFunction f);

// get the current status of a key or the mouse
int atto_key_is_down(int code);
void atto_get_mouse(int *x, int *y);

// Interaction Functions:
// The string values returned from some of these functions are ONLY valid until 
// the next time that function is called.  Copy the strings if you want to keep them.
void atto_message(const char *string);
const char *atto_input(const char *prompt, const char *default_string);
int atto_choice(const char *question, const char *option0, const char *option1, const char *option2);
const char *atto_file_chooser(const char *prompt, const char *tabSeparatedPatterns);
const char *atto_dir_chooser(const char *prompt);
int atto_color_chooser(const char *title, float *r, float *g, float *b);
void atto_beep();

// some useful key constants (provided by FLTK) for use in your key(code) function
/*
FL_BackSpace - The backspace key.
FL_Tab - The tab key.
FL_Enter - The enter key.
FL_Escape - The escape key.
FL_Left - The left arrow key.
FL_Up - The up arrow key.
FL_Right - The right arrow key.
FL_Down - The down arrow key.
FL_KP - One of the keypad numbers; use FL_KP + n for number n.
FL_KP_Enter - The enter key on the keypad.
FL_F - One of the function keys; use FL_F + n for function key n.
FL_Shift_L - The lefthand shift key.
FL_Shift_R - The righthand shift key.
FL_Control_L - The lefthand control key.
FL_Control_R - The righthand control key.
FL_Caps_Lock - The caps lock key.
FL_Alt_L - The left alt key.
FL_Alt_R - The right alt key.
FL_Delete - The delete key.
*/

#endif
